/*
"TypeError: Cannot set property 'error' of undefined
    at errorClick (http://localhost:8080/:18:28)
    at HTMLInputElement.onclick (http://localhost:8080/:11:67)"

↓

undefinederrorClick (http://localhost:8080/:18:28)^undefinedHTMLInputElement.onclick (http://localhost:8080/:11:67)

干掉第一行重复的message信息, 干掉换行符 和 空格, 取而代之, 多行之间用^连接
*/
function getStackLines(stack){
  return stack.split('\n').slice(1).map(item=>item.replace(/^\s+at\s+/g,'')).join('^')
}

export default getStackLines;
